# url = 'https://www.acwing.com/problem/content/3550/'

n = int(input())

while True:
    if sum(map(int, list(str(n)))) % 4 == 0:
        print(n)
        break

    n += 1